#include <iostream>
#include <vector>

using namespace std;

class Solution {
public:
  int removeElement(vector<int> &nums, int val) {
    int eq_num = 0;
    int ne_num = 0;

    int idx = 0;

    for (idx = 0; idx < nums.size(); idx++) {
      if (nums[idx] == val) {
        eq_num++;
      } else {
        nums[idx - eq_num] = nums[idx];
        ne_num++;
      }
    }

    return ne_num;
  }
};

bool test_case01() {
  vector<int> nums;
  nums.push_back(3);
  nums.push_back(2);
  nums.push_back(2);
  nums.push_back(3);
  int val = 3;

  Solution so;
  int res;
  res = so.removeElement(nums, val);
  cout << "res: " << res << endl;
  return true;
}

int main() {
  test_case01();
  return 0;
}
